<?php

namespace App\Http\Controllers\Stats\User;

use Helper\Timed;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Resources\Common\DatasResource;
use App\Services\Stats\User\PlayerBetService;

class PlayerBetController extends Controller
{

	public function __construct()
	{
		Timed::setForceNotAbs();
	}
    /**
     * 获取数据列表【小时】
     */
    public function hour(Request $request)
    {
        list ($collection, $total, $stats) = PlayerBetService::create()->hour($request);

        return DatasResource::make($collection)->setPaginateTotal($total)->setAttribute('stats', $stats);
    }

    /**
     * 获取数据列表【天】
     */
    public function day(Request $request)
    {
        list ($collection, $total, $stats) = PlayerBetService::create()->day($request);

        return DatasResource::make($collection)->setPaginateTotal($total)->setAttribute('stats', $stats);
    }

    /**
     * 获取数据列表【月】
     */
    public function month(Request $request)
    {
        list ($collection, $total, $stats) = PlayerBetService::create()->month($request);

        return DatasResource::make($collection)->setPaginateTotal($total)->setAttribute('stats', $stats);
    }
}
